package com.example.Activity.service.impl;

import com.example.Activity.domain.Activity;
import com.example.Activity.domain.Vo.ActivityListVo;
import com.example.Activity.mapper.ActivityMapper;
import com.example.Activity.service.IActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;

@Service
public class ActivityServiceImpl implements IActivityService {
    @Autowired
    private ActivityMapper activityMapper;

    @Override
    public List<ActivityListVo> selectActivity(Activity activity) {
        return activityMapper.selectActivity(activity);
    }

    @Override
    public void insertActivity(Activity activity) {
        activity.setCreateTime(LocalDateTime.now());
        activity.setUpdateTime(LocalDateTime.now());
        activityMapper.insertActivity(activity);
    }

    @Override
    public void updateActivityById(Activity activity) {
        activity.setUpdateTime(LocalDateTime.now());
        activityMapper.updateActivityById(activity);
    }

    @Override
    public void delActivityById(String id) {
        activityMapper.delActivityById(id);
    }

    @Override
    public ActivityListVo selectActivityById(Integer id) {
        return activityMapper.selectActivityById(id);
    }
}